<!--  -->
<template>
  <div>
    <at-menu mode="horizontal" active-name="1">
      <at-menu-item name="1">
        <i class="icon icon-chevron-left" @click="mback"></i>会议室详情
      </at-menu-item>
    </at-menu>
    <div class="content">
      <el-carousel :interval="4000" type="card" height="200px">
        <el-carousel-item v-for="(item,index) in bannerlist" :key="index">
          <div
            class="medium"
            :style="{backgroundImage:'url(' + require('../../assets/images/'+item) + ')',
            'background-size':'cover',
            height:'100%'
            }"
          ></div>
        </el-carousel-item>
      </el-carousel>

      <div class="row at-row">
        <div class="col-md-5 shadowstyle">
          <div class="roominforcontent">
            <div class="roomname">{{minfor.name}}</div>
            <div class="roomplace">{{minfor.addr}}</div>
            <div class="triangle"></div>
            <div class="roombg"></div>
          </div>
        </div>
        <div class="col-md-18 col-md-offset-1 shadowstyle">
          <div class="inforitem">
            <div class="title">可容纳人数</div>
            <div class="mcontent">
              <div class="peoplenumber">
                <animated-number
                  :value="minfor.number"
                  :formatValue="formatToPrice"
                  :duration="800"
                />
              </div>
            </div>
          </div>
          <div class="inforitem">
            <div class="title">硬件设备</div>
            <div class="mcontent">
              <at-card
                style="margin-right:20px"
                :body-style="{ padding: 0 }"
                v-for="(item,index) in minfor.devices"
                :key="index"
                :class="`animated bounceInUp delay-${index}s`"
              >
                <div>
                  <div class="devicepic">
                    <i class="icon icon-airplay" v-if="item.name=='投影仪'"></i>
                    <i class="icon icon-speaker" v-if="item.name=='摄像头'"></i>
                    <i class="icon icon-airplay" v-if="item.name=='设备遥控'"></i>
                    <i class="icon icon-monitor" v-if="item.name=='27寸屏幕'"></i>
                    <i class="icon icon-package" v-else></i>
                  </div>
                  <div class="line"></div>
                  <div class="devicename">
                    <at-badge :value="item.number" status="info">
                      <span>{{item.name}}</span>
                    </at-badge>
                  </div>
                </div>
              </at-card>
            </div>
          </div>
          <router-link
            :to="{
            path:'/reserve',
            query:{
              name:minfor.name
            }
          }"
          >
            <el-button type="primary" style="margin:30px 0">立即预定</el-button>
          </router-link>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { back } from "../../assets/js/common";
import AnimatedNumber from "animated-number-vue";
import { setCookie, getCookie, removeCookie } from "../../assets/js/common";
import { fetch, post } from "../../config/request";
export default {
  data() {
    return {
      minfor: this.$route.query.infor,
      bannerlist: ["banner1.jpg", "banner2.jpg", "banner3.jpg"]
    };
  },

  components: { AnimatedNumber },
  created() {
    this.minfor.devices.map((item, index) => {
      item.number = Math.ceil(Math.random() * 5);
    });
  },
  computed: {},

  methods: {
    formatToPrice(value) {
      return Math.floor(value);
    },
    mback() {
      back();
    }
  }
};
</script>
<style scoped lang="scss">
.content {
  .medium {
    width: 100%;
    height: 100%;
    background-size: cover;
  }
  .shadowstyle {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
    .roominforcontent {
      width: 100%;
      height: 100%;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      position: relative;
      padding: 10px 20px;
      background-image: url("../../assets/images/roominforbg.jpg");
      background-size: cover;
      color: white;
      .roomname {
        text-align: left;
        font-size: 25px;
        font-weight: bold;
        border-bottom: 1px solid rgb(224, 224, 224);
        padding-bottom: 20px;
        z-index: 3;
      }
      .roomplace {
        text-align: left;
        color: rgb(194, 194, 194);
        margin: 5px 0;
        margin-top: 20px;
        z-index: 3;
      }
      .roombg {
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        bottom: 0;
        background: #00000080;
      }
    }
  }

  .inforitem {
    margin-bottom: 10px;
    padding-bottom: 10px;
    padding: 10px 20px;

    .title {
      text-align: left;
      margin-bottom: 20px;
    }
    .mcontent {
      display: flex;
      .devicepic {
        width: 110px;
        margin-top: 20px;
        i {
          font-size: 25px;
        }
      }
      .line {
        width: 15px;
        height: 1px;
        background: #3e76de;
        margin: 20px auto;
      }
      .devicename {
        margin-bottom: 20px;
      }
      .peoplenumber {
        border-radius: 100%;
        border: 1px solid #ccc;
        width: 50px;
        height: 50px;
        text-align: center;
        line-height: 50px;
        font-size: 25px;
      }
    }
  }
}
</style>
<style>
.el-carousel__item h3 {
  color: #475669;
  font-size: 14px;
  opacity: 0.75;
  line-height: 200px;
  margin: 0;
  background-size: 100% 100%;
}
h3 :nth-of-type(1) {
  background: url("../../assets/images/banner1.jpg");
}
</style>